home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 May / PCWorld_2000-05_cd.bin / Software / TemaCD / povray / povwin3.exe / %MAINDIR% / Insert Menu / Misc. Directives / switch example.txt < prev    next >
Encoding:
Text File  |  2000-04-06  |  739 b   |  24 lines

  1. // Let's make some constant names
  2. #declare CS_Easy   = 1
  3. #declare CS_Medium = 3
  4. #declare CS_Hard   = 5
  5.  
  6. // Let the user choose the method to use
  7. #declare Complexity_Switch = CS_Medium // or CS_Easy or CS_Hard
  8.  
  9. // Do something dependent on the user's choice
  10. #switch (Complexity_Switch)
  11.   #case (CS_Easy)
  12.   // This statement is done if (Complexity_Switch = CS_Easy)
  13.   #declare MyShape = box{-1,+1}
  14.   #break // end of CS_Easy
  15.   #case (CS_Medium, CS_Hard)
  16.   // This statement is done if Complexity_Switch is CS_Medium
  17.   // or CS_Hard or anything in between
  18.   #declare MyShape = torus{1, 0.5}
  19.   #break // end of CS_Hard
  20.   #else
  21.   // This statement is done if none of the above match
  22.   #declare MyShape = sphere{0,1}
  23. #end
  24.